<?php


namespace app\common\service\companyIndustry\simulation;

use app\common\service\BaseService;

/**
 * 模拟数据 - 脱硫烟气量
 */
class SimulationGasOutService extends BaseService
{
    /**
     * （减排前）减排前烟气量
     * @param int $companyId 公司ID
     * @param int $days 天数
     * @return bool|float|int
     * @author hongwei 2019-07-16
     */
    public function getBeforeFlueGas($companyId, $days = 1)
    {
        $sql = 'select gas_volume from company_industry_monitor_simulation_hour_avg where company_id =' . $companyId;
        $sth = $this->pdo->prepare($sql);
        $sth->execute();
        $data = $sth->fetch();
        if (!$data) {
            return false;
        }
        $result = $data['gas_volume'] * 24 * $days; //默认$data['gas_volume']是小时平均值
        return $result;
    }
}